Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX+Spec] Fractional not being BigDecimal upon deserialization #232

Merged
merged 3 commits into from Dec 5, 2012

Conversation

klevo
Copy link

@klevo klevo commented Dec 1, 2012

Loading a YAML serialized money object is a common use case when dealing with persisting the money object in a queue, for example delayed_job. We need to ensure @fractional is BigDecimal before calling #round with two parameters on it. Float class only provides #round with 0 or 1 parameter. Spec included.

…onal can end up being set to a Float. We need to ensure it is BigDecimal before calling #round with two paramers. Float class only provides #round with 0 or 1 parameter. Spec included.
@@ -146,6 +146,35 @@ def expectation.fractional
m.fractional.should be_a(Fixnum)
end
end

it "when loading a serialized Money object from YAML fractional rounding always works on bigdecimal" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

context "loading a serialized Money via YAML" do
  it "uses BigDecimal when rounding" do

@semmons99
Copy link
Member

Please figure out why this is failing with ruby-1.9.2-p320 and fix. Thanks for the patch!

semmons99 added a commit that referenced this pull request Dec 5, 2012
[FIX+Spec] Fractional not being BigDecimal upon deserialization
@semmons99 semmons99 merged commit 1cc9e46 into RubyMoney:master Dec 5, 2012
@semmons99
Copy link
Member

Thanks for the patch @klevo, sorry I didn't merge it sooner. You now have a commit bit on the repo.

@klevo
Copy link
Author

klevo commented Dec 5, 2012

awesome, thanks!

On Dec 5, 2012, at 5:21 AM, Shane Emmons notifications@github.com wrote:

Thanks for the patch @klevo, sorry I didn't merge it sooner. You now have a commit bit on the repo.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants